import { instance } from '@/utils/server.js';
import {
  custom,
  quotation,
  pcbOrder,
  dictionaryList,
  pcbProcessType,
  product,
  processServiceQuotation,
} from '../apiUrl/biz';
const BASE_URL = '/mall-api';

/**
 * 修改会员信息
 * @param {} params
 * @returns
 */
export const modifyUserInfo = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.memberAccount.updateAccount, params)
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 修改密码
 * @param {*} params
 * @returns
 */
export const modifyPassword = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.memberAccount.updatePassword, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 获取公司信息
 * @param {*} params
 * @returns
 */
export const getCompanyInfo = () => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.clientCompanyInfo.queryById)
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 添加快递地址
 * @param {*} params
 * @returns
 */
export const addAddress = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.deliveryAddress.addAddress, params)
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 删除快递地址
 * @param {*} params
 * @returns
 */
export const deleteAddress = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(`${custom.deliveryAddress.delete}` + params)
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 查询快递地址
 * @param {*} params
 * @returns
 */
export const inquireAddress = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .get(custom.deliveryAddress.inquire + `/${params.id}`, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 快递地址列表
 * @param {*} params
 * @returns
 */
export const listAddress = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .get(custom.deliveryAddress.list, { params: params })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

// 国家省份城市地区
export const provincesCitiesAndDistricts = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.deliveryAddress.region, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 更新快递地址
 * @param {*} params
 * @returns
 */
export const updateAddress = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.deliveryAddress.update, params)
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 查询文件解析数据进度
 * @param {*} params
 * @returns
 */
export const fileProcessingProgress = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .get(custom.attachmentFileList.inquire + params)
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 修改邮箱获取新旧验证码
 * @param {*} params
 */
export const getEmailVerificationCode = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.memberAccount.getEmailVerificationCode, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 验证修改邮箱
 * @param {*} params
 * @returns
 */
export const setVerificationCode = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.memberAccount.verificationCode, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 获取bom清单列表
 * @param {*} params
 * @returns
 */
export const getQueryPageList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .get(quotation.queryPageList, {
        params: params,
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 获取bom统计数据
 * @param {*} params
 * @returns
 */
export const getBomMatchListStatisticsData = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(quotation.getBomMatchListStatisticsData, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * bom报价清单-不贴物料移入贴片
 * @param {*} params
 * @returns
 */
export const addBomMatchList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(quotation.addBomMatchList, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * bom报价清单-物料型号品牌确认
 * @param {*} params
 * @returns
 */
export const confirmBomMatchId = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(quotation.confirmBomMatchId, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * bom报价清单-贴片物料移入不贴
 * @param {*} params
 * @returns
 */
export const deleteBomMatchList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(quotation.deleteBomMatchList, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        console.log(res);
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/***
 * bom报价清单-修改物料为邮寄
 */
export const updateBomExpress = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(quotation.updateBomExpress, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        console.log(res);
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 客户附件删除
 * @param {*} params
 * @returns
 */
export const deleteFile = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.attachmentFileList.delete, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 获取固件列表
 * @param {*} params
 * @returns
 */
export const getqueryBomPageList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .get(custom.attachmentFileList.queryBomPageList, { params: params })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 查询文件
 * @param {*} params
 * @returns
 */
export const inquireFile = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .get(custom.attachmentFileList.inquire + params)
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * gerber渲染3D文件数据文件列表
 * @param {*} params
 * @returns
 */
export const gerberFilelist = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .get(custom.gerberChecklist.list + `?gerberFileId=${params}`)
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

export const getAgainMatchBom = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(quotation.againMatchBom, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 获取邮寄清单列表
 * @param {*} params
 * @returns
 */
export const getMailingList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.mailingMaterials.queryPagePcbaOrderWaitExpressList, params, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 加入包裹
 * @param {*} params
 * @returns
 */
export const addPcbaOrderToExpress = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.mailingMaterials.addPcbaOrderToExpress + params, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * bom元件信息列表
 * @param {*} params
 * @returns
 */
export const queryPagePcbaSmtBomOrderExpressList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.mailingMaterials.queryPagePcbaSmtBomOrderExpressList, params, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * pcb元件信息列表
 * @param {*} params
 * @returns
 */
export const queryPagePcbaSmtPcbExpressMaterialsList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.mailingMaterials.queryPagePcbaSmtPcbExpressMaterialsList, params, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 移除包裹
 * @param {*} params
 * @returns
 */
export const deleteExpressMaterialsId = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.mailingMaterials.deleteExpressMaterialsId, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 修改邮寄数量
 * @param {*} params
 * @returns
 */
export const updateMaterialsQuantity = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.mailingMaterials.updateMaterialsQuantity, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 获取全部包裹
 * @param {*} params
 * @returns
 */
export const queryPagePcbaWaitExpressMaterialsList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.mailingMaterials.queryPagePcbaWaitExpressMaterialsList, params, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/***
 * 提交快递订单
 */
export const createPcbaOrderExpress = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.mailingMaterials.createPcbaOrderExpress, params, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 邮寄记录列表
 * @param {*} params
 * @returns
 */
export const getMailingRecordsList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.mailingMaterials.queryPageList, params, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 取消邮寄
 */
export const cancelPcbaSmtExpress = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.mailingMaterials.cancelPcbaSmtExpress + params)
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * bom订单明细
 * @param {*} params
 * @returns
 */
export const getBomOrderDetail = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.bomOrderDetail.queryPageList, params, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => {
        console.log(res);
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * bom订单明细删除
 * @param {*} params
 * @returns
 */
export const deleteBomOrderDetail = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(custom.bomOrderDetail.delete + params)
      .then((res) => {
        console.log(res);
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
};

/**
 * 获取服务类型列表
 * @param {*} params
 * @returns
 */
export const getPcbaServiceCategoryList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(pcbOrder.serviceType.getPcbaServiceCategoryList, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 创建smt订单
 * @param {*} params
 * @returns
 */
export const addSmt = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(pcbOrder.pcbOrder.createPcbaOrder, params, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 获取订单详情
 * @param {*} params
 * @returns
 */
export const getPcbInfo = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .get(pcbOrder.pcbOrder.pcbInfo + params, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

// /**
//  * 创建订单快递信息
//  * @param {*} params
//  * @returns
//  */
// export const setCreateOrderCourierInfo = (params) => {
//   return new Promise((resolve, reject) => {
//     instance
//       .post(pcbOrder.pcbOrder.createOrderCourierInfo, params, {
//         headers: {
//           'Content-Type': 'application/json;charset=UTF-8',
//         },
//       })
//       .then((res) => resolve(res))
//       .catch((err) => reject(err));
//   });
// };

/**
 * pcb  smt订单列表
 * @param {*} params
 * @returns
 */
export const getPcbSmtList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(pcbOrder.pcbOrder.pcbaOrderLsit, params, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * pcb 小项订单列表详情
 * @param {*} params
 * @returns
 */
export const queryPcbaPcbOrderList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(pcbOrder.pcbOrderDetail.queryPcbaPcbOrderList, params, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * pcb 非客户邮寄pcb订单列表
 */
export const queryHistoryPcbaPcbOrderList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post('/mall-api/biz/crmPcbaPcbOrder/queryHistoryPcbaPcbOrderList', params, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 获取快递公司列表
 * @returns
 */
export const getExpressCompanyList = () => {
  return new Promise((resolve, reject) => {
    instance
      .get(pcbOrder.expressCompanyList, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

// pcba商城退款
export const postPcbaRefundOrder = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(pcbOrder.pcbaRefundOrder, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 创建支付订单
 * @param {*} params
 * @returns
 */
export const creatPayOrder = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(pcbOrder.paymentModule.creatPayOrder, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 取消订单
 * @param {*} params
 * @returns
 */
export const cancelOrderById = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .get(pcbOrder.pcbOrder.cancelOrderById + params)
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 删除订单信息
 * @param {*} params
 * @returns
 */

export const deleteOrderById = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .get(pcbOrder.pcbOrder.deleteOrder + params)
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 确认支付
 * @param {*} params
 * @returns
 */
export const confirmPayOrder = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(pcbOrder.paymentModule.confirmPayOrder, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 取消支付
 * @param {*} params
 * @returns
 */
export const cancelUnPayOrder = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(pcbOrder.paymentModule.cancelUnPayOrder, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 获取状态列表
 * @param {*} params
 * @returns
 */
export const getDictList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(dictionaryList.getDictList, {
        headers: {
          'Content-Type': 'application/json;charset=UTF-8',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * pcb工艺类型详情
 * @param {*} params
 * @returns
 */
export const queryCraftsCategoryDetail = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .get(pcbProcessType.queryCraftsCategoryDetail + params)
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * pcb工艺类型列表
 * @param {*} params
 * @returns
 */
export const queryCraftsCategoryList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(pcbProcessType.queryCraftsCategoryList, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * pcb产品工艺信息过滤刷选
 * @param {*} params
 * @returns
 */
export const productCraftsFilterList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(product.productCraftsFilterList, params)
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 获取产品列表
 * @param {*} params
 * @returns
 */
export const getProductList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(product.productList, params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 获取产品分类列表
 * @param {*} params
 * @returns
 */
export const getDictTypeList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post('/mall-api/biz/crmProductCategory/queryPageList', params, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 客户PCBA订单- 计算报价 （PCB SMT 报价）
 * @param {*} params
 */
export const crmPcbaOrderCalculationAmountAPI = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(`${BASE_URL}/biz/crmPcbaOrder/calculationAmount`, params, {
        headers: {
          'Content-Type': 'application/json',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * SMT工艺报价
 * @param {*} params
 */
export const getSmtProcessServiceQuotation = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(processServiceQuotation.smtProcessServiceQuotation, params, {
        headers: {
          'Content-Type': 'application/json',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * bom工艺报价
 * @param {*} params
 */
export const getBomProcessServiceQuotation = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(processServiceQuotation.bomProcessServiceQuotation + `${params}`)
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 获取物料生产批次信息
 * @param {*} params
 */
export const queryOmsProductionMaterialBatchList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post('/mall-api/biz/omsOMSSettingsProductionMaterialBatch/queryPageList', params, {
        headers: {
          'Content-Type': 'application/json',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 获取坐标文件加工点列表
 * @param {*} params
 */
export const queryOmsMallPcbaBomMatchCoordinateList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post('/mall-api/biz/omsMallPcbaBomMatchCoordinateList/queryPageList', params, {
        headers: {
          'Content-Type': 'application/json',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 获取商城订单-退款订单 分页列表
 * @param {*} params
 */
export const queryOmsMallPaymentRefundOrderPageList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post('/mall-api/biz/omsMallPaymentRefundOrder/queryPageList', params, {
        headers: {
          'Content-Type': 'application/json',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 商城订单-退款订单 取消
 * @param {*} params
 */
export const cancelOmsMallPaymentRefundOrder = (id) => {
  return new Promise((resolve, reject) => {
    instance
      .post(
        `/mall-api/biz/omsMallPaymentRefundOrder/cancel/${id}`,
        {},
        {
          headers: {
            'Content-Type': 'application/json',
          },
        },
      )
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 商城订单-退款订单 删除
 * @param {*} params
 */
export const deleteOmsMallPaymentRefundOrder = (id) => {
  return new Promise((resolve, reject) => {
    instance
      .post(
        `/mall-api/biz/omsMallPaymentRefundOrder/delete/${id}`,
        {},
        {
          headers: {
            'Content-Type': 'application/json',
          },
        },
      )
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 商城订单-退款订单 删除
 * @param {*} params
 */
export const updateOrderExpressAPI = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(`/mall-api/biz/crmPcbaOrder/updateOrderExpress`, params, {
        headers: {
          'Content-Type': 'application/json',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};

/**
 * 获取元器件产品信息
 * @param {*} params
 */
export const queryComponentsProductsPageList = (params) => {
  return new Promise((resolve, reject) => {
    instance
      .post(`/mall-api/components/componentsProducts/queryPageList`, params, {
        headers: {
          'Content-Type': 'application/json',
        },
      })
      .then((res) => resolve(res))
      .catch((err) => reject(err));
  });
};
